//
//  InfoOutPutTableViewCell.m
//  marrymarry
//
//  Created by lsj on 16/9/22.
//  Copyright © 2016年 cf. All rights reserved.
//

#import "InfoOutPutTableViewCell.h"

@implementation InfoOutPutTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
-(void)reloadWithDic:(NSDictionary *)MyDic andIsOhterLook:(BOOL)isOtherLook andIsClickBtn:(BOOL)isClickWatch
{
    NSLog(@"MyDic ============= %@",MyDic);
    NSString * oldStr = [NSString stringWithFormat:@"%@",MyDic[@"user"][BIRTH_TIME_KEY]];
    oldStr = [oldStr substringToIndex:3];
    NSDate *date = [NSDate date];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    [formatter setDateFormat:@"YYYY-MM-dd"];
    NSString *DateTime = [formatter stringFromDate:date];
    NSString * yearStr = [DateTime substringToIndex:3];
    self.birthday = [NSString stringWithFormat:@"%d",([yearStr intValue] - [oldStr intValue])];
    
    self.MyInfoLabel.text= [NSString stringWithFormat:@"%@ %@ %@ %@岁",MyDic[@"user"][NICHEN_KEY],MyDic[@"user"][SEX_KEY],MyDic[@"user"][STUDY_KEY],self.birthday];
    self.wantMarryTimeLabel.text = [NSString stringWithFormat:@"期望%@结婚",MyDic[@"user"][WANT_MARRY_TIME_KEY]];
    NSString * trueNameStr = MyDic[@"user"][@"realName"];
    if ([trueNameStr isEqualToString:@""]) {
        self.TrueNameLabel.text = @"未*";
    }else{
        self.TrueNameLabel.text =[NSString stringWithFormat:@"%@*",[trueNameStr substringToIndex:0]];
    }
    
    
    if (isOtherLook) {
        if (isClickWatch) {
            if ([MyDic[@"user"][@"cdcard"] isEqualToString:@""]) {
                self.cardNumberLabel.text = [NSString stringWithFormat:@"身份证号:未填写"];
            }else{
            self.cardNumberLabel.text = [NSString stringWithFormat:@"身份证号:%@",MyDic[@"user"][@"cdcard"]];
            }
            if ([MyDic[@"user"][@"school"] isEqualToString:@""]) {
                self.collageLabel.text = [NSString stringWithFormat:@"学校:未填写"];
            }else{
            self.collageLabel.text = [NSString stringWithFormat:@"学校:%@",MyDic[@"user"][@"school"]];
            }
            if ([MyDic[@"user"][@"major"] isEqualToString:@""]) {
                self.skillLabel.text = [NSString stringWithFormat:@"专业:未填写"];
            }else{
            self.skillLabel.text = [NSString stringWithFormat:@"专业:%@",MyDic[@"user"][@"major"]];
            }

        }else{
        self.cardNumberLabel.text = [NSString stringWithFormat:@"身份证号"];
        self.collageLabel.text = [NSString stringWithFormat:@"毕业学校"];
        self.skillLabel.text = [NSString stringWithFormat:@"所学专业"];
        }
    }
    else{
        NSLog(@"hhhhhhh ======  %@",MyDic[@"user"][@"cdcard"]);
    self.cardNumberLabel.text = [NSString stringWithFormat:@"身份证号:%@",MyDic[@"user"][@"cdcard"]];
    self.collageLabel.text = [NSString stringWithFormat:@"学校:%@",MyDic[@"user"][@"school"]];
    self.skillLabel.text = [NSString stringWithFormat:@"专业:%@",MyDic[@"user"][@"major"]];
    }
    
    if ([self.cardNumberLabel.text isEqualToString:@""]) {
        self.cardAcceptTime.hidden =YES;
        self.studyAcceptLabel.hidden = YES;
    }
    NSLog(@"MyDic ====  %@",MyDic[@"idcard"][@"status"]);
    if ([[NSString stringWithFormat:@"%@",MyDic[@"idcard"][@"status"]] isEqualToString:@"0"]) {
        [self.idCardRZImgView setImage:[UIImage imageNamed:@"notp.png"]];
        self.cardAcceptTime.text = @"审核中";
    }else if ([[NSString stringWithFormat:@"%@",MyDic[@"idcard"][@"status"]] isEqualToString:@"1"])
    {
        
        [self.idCardRZImgView setImage:[UIImage imageNamed:@"yiRenZhen.png"]];
        NSString * str =[NSString stringWithFormat:@"%@",MyDic[@"idcard"][@"submitTime"]];
       
        
        NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:[str integerValue]/1000];
    
      
        NSLog(@"date1:%@",confromTimesp);
        self.cardAcceptTime.text =[NSString stringWithFormat:@"认证通过:%@",[formatter stringFromDate:confromTimesp]];
    }
    else if ([[NSString stringWithFormat:@"%@",MyDic[@"idcard"][@"status"]] isEqualToString:@"2"])
    {
        [self.idCardRZImgView setImage:[UIImage imageNamed:@"notp.png"]];
        self.cardAcceptTime.text = @"审核未通过";
    }
    
    
    
    if ([[NSString stringWithFormat:@"%@",MyDic[@"educational"][@"status"]] isEqualToString:@"0"]) {
        [self.studyCardRZImgView setImage:[UIImage imageNamed:@"notp.png"]];
        self.studyAcceptLabel.text = @"审核中";
    }else if ([[NSString stringWithFormat:@"%@",MyDic[@"educational"][@"status"]] isEqualToString:@"1"])
    {
        [self.studyCardRZImgView setImage:[UIImage imageNamed:@"yiRenZhen.png"]];
        NSString * str =[NSString stringWithFormat:@"%@",MyDic[@"idcard"][@"submitTime"]];
        NSDate *confromTimesp = [NSDate dateWithTimeIntervalSince1970:[str integerValue]/1000];
        self.studyAcceptLabel.text =[NSString stringWithFormat:@"认证通过:%@",[formatter stringFromDate:confromTimesp]];
    }
    else if ([[NSString stringWithFormat:@"%@",MyDic[@"educational"][@"status"]] isEqualToString:@"2"])
    {
        [self.studyCardRZImgView setImage:[UIImage imageNamed:@"notp.png"]];
        self.studyAcceptLabel.text = @"审核未通过";
    }
    
    
}
@end
